<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Main.mxml</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version="1.0" encoding="utf-8"?&gt;</span>
<span class="MXMLComponent_Tag">&lt;s:Application</span><span class="MXMLDefault_Text"> xmlns:mx="</span><span class="MXMLString">library://ns.adobe.com/flex/mx</span><span class="MXMLDefault_Text">"
               xmlns:s="</span><span class="MXMLString">library://ns.adobe.com/flex/spark</span><span class="MXMLDefault_Text">"
               xmlns:fx="</span><span class="MXMLString">http://ns.adobe.com/mxml/2009</span><span class="MXMLDefault_Text">"
               xmlns:presentation="</span><span class="MXMLString">task.presentation.*</span><span class="MXMLDefault_Text">"
               creationComplete="</span><span class="ActionScriptDefault_Text">creationCompleteHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">" viewSourceURL="</span><span class="MXMLString">srcview/index.html</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>

    <span class="MXMLSpecial_Tag">&lt;fx:Script&gt;</span>&lt;![CDATA[
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">events</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">FlexEvent</span>;

        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">org</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">flexthinker</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">binding</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">form</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">FormModel</span>;
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">org</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">flexthinker</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">binding</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">form</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">support</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">DefaultFormModel</span>;
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">org</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">flexthinker</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">binding</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">form</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">support</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">DefaultValidatingFormModel</span>;

        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">task</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">domain</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Task</span>;

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">formModel</span>:<span class="ActionScriptDefault_Text">FormModel</span>;
        <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">currentTask</span>:<span class="ActionScriptDefault_Text">Task</span>;

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">creationCompleteHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">FlexEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptComment">// create a new task, as binding DataSource
</span>            <span class="ActionScriptDefault_Text">currentTask</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Task</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptComment">// wrap the task into a default form Model
</span>            <span class="ActionScriptDefault_Text">formModel</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">DefaultFormModel</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">currentTask</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptReserved">true</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">taskForm</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">formModel</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">formModel</span>;
            <span class="ActionScriptComment">// wrap the task into a new form Model, in order to listen to changes in the task object
</span>            <span class="ActionScriptDefault_Text">taskView</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">formModel</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">DefaultFormModel</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">currentTask</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptReserved">false</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">submitButton_clickHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">formModel</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">commit</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">autoCommitCheckBox_changeHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">formModel</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">commit</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">autoCommitCheckBox</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">selected</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// setting buffering to false,  will push changes instantly into the currentTask
</span>                <span class="ActionScriptDefault_Text">formModel</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">DefaultFormModel</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">currentTask</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptReserved">false</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">taskForm</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">formModel</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">formModel</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">else</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">//setting buffering to true, will buffer changes until 'commit'  method is called
</span>                <span class="ActionScriptDefault_Text">formModel</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">DefaultFormModel</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">currentTask</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptReserved">true</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">taskForm</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">formModel</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">formModel</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">pauseBindingCheckBox_changeHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">taskView</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">updateBindingState</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">pauseBindingCheckBox</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">selected</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">&gt;</span><span class="MXMLSpecial_Tag">&lt;/fx:Script&gt;</span>


    <span class="MXMLComponent_Tag">&lt;s:HGroup&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:VGroup</span><span class="MXMLDefault_Text"> paddingLeft="</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;presentation:TaskForm</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">taskForm</span><span class="MXMLDefault_Text">" width="</span><span class="MXMLString">300</span><span class="MXMLDefault_Text">" skinClass="</span><span class="MXMLString">task.skin.TaskFormSkin</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;s:HGroup</span><span class="MXMLDefault_Text"> paddingLeft="</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">" gap="</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
                <span class="MXMLComponent_Tag">&lt;s:CheckBox</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">autoCommitCheckBox</span><span class="MXMLDefault_Text">" label="</span><span class="MXMLString">Allow Auto-Commit</span><span class="MXMLDefault_Text">"
                            change="</span><span class="ActionScriptDefault_Text">autoCommitCheckBox_changeHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">/&gt;</span>
                <span class="MXMLComponent_Tag">&lt;s:Button</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">submitButton</span><span class="MXMLDefault_Text">" label="</span><span class="MXMLString">Submit</span><span class="MXMLDefault_Text">" click="</span><span class="ActionScriptDefault_Text">submitButton_clickHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;/s:HGroup&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/s:VGroup&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:VGroup</span><span class="MXMLDefault_Text"> gap="</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;presentation:TaskView</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">taskView</span><span class="MXMLDefault_Text">" width="</span><span class="MXMLString">300</span><span class="MXMLDefault_Text">" skinClass="</span><span class="MXMLString">task.skin.TaskViewSkin</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;s:HGroup</span><span class="MXMLDefault_Text"> paddingLeft="</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
                <span class="MXMLComponent_Tag">&lt;s:CheckBox</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">pauseBindingCheckBox</span><span class="MXMLDefault_Text">" label="</span><span class="MXMLString">Pause Binding</span><span class="MXMLDefault_Text">"
                            change="</span><span class="ActionScriptDefault_Text">pauseBindingCheckBox_changeHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;/s:HGroup&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/s:VGroup&gt;</span>


    <span class="MXMLComponent_Tag">&lt;/s:HGroup&gt;</span>

<span class="MXMLComponent_Tag">&lt;/s:Application&gt;</span></pre></body>
</html>
